home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / wrb100b.zip / WFILEXFR.BAT < prev    next >
DOS Batch File  |  1993-01-07  |  14KB  |  333 lines

  1. @ECHO OFF
  2. REM
  3. REM          %1  -  Single character describing the communications port that
  4. REM                 was in use on WR-BBS when this batch file was called. It
  5. REM                 will be one of the folllowing:  1, 2, 3, 4, or N.    The
  6. REM                 numbers represent COM ports, while "N" means the session
  7. REM                 is local and the communications port is not in use.
  8. REM
  9. REM          %2  -  A numeric string, representing the baud rate that was in
  10. REM                 effect when this batch file was called.   If the session
  11. REM                 is local, then the string "LOCAL" will be passed as this
  12. REM                 parameter.  Examples include:  300, 1200, 2400, etc.
  13. REM
  14. REM          %3  -  This parameter indicates whether the file transfer is an
  15. REM                 upload to this BBS ("RECEIVE"),  or a download from this
  16. REM                 BBS ("SEND").  These are the only values possible.
  17. REM
  18. REM          %4  -  The protocol keyword.
  19. REM
  20. REM          %5  -  The name of the file to be transferred, or the file name
  21. REM                 of a list file which contains several filenames that are
  22. REM                 to be transferred.   A list file will be created only if 
  23. REM                 the protocol is configured for batch transmission.  This
  24. REM                 means that all upload (RECEIVE) protocols and all single
  25. REM                 action download (SEND) protocols will have a single file
  26. REM                 name here. If a batch protocol is used but only one file
  27. REM                 is selected for download,   then a single file name will 
  28. REM                 appear here as well.  The next parameter (%6) designates  
  29. REM                 whether the transmission is "batch" or "single".
  30. REM
  31. REM          %6  -  A numeric string, representing the number of files to be
  32. REM                 transferred.  This string will always be "1" for uploads
  33. REM                 (RECEIVE), non-batch downloads, and batch downloads when
  34. REM                 a single file is requested.  If a multiple file download
  35. REM                 (batch) is requested, then this string will be a numeric
  36. REM                 value between 2 and 65355.
  37. REM
  38. REM          Verify that all expected parameters were passed.
  39. REM
  40. IF W%1==WW GOTO ERROR01
  41. IF W%2==WW GOTO ERROR02
  42. IF W%3==WW GOTO ERROR02
  43. IF W%4==WW GOTO ERROR02
  44. IF W%5==WW GOTO ERROR02
  45. IF W%6==WW GOTO ERROR02
  46. REM
  47. REM          Echo the parameters to the local screen.
  48. REM
  49. ECHO Parameters passed to %0:
  50. ECHO.
  51. ECHO 1  -  %1
  52. ECHO 2  -  %2
  53. ECHO 3  -  %3
  54. ECHO 4  -  %4
  55. ECHO 5  -  %5
  56. ECHO 6  -  %6
  57. ECHO 7  -  %7
  58. ECHO 8  -  %8
  59. ECHO.
  60. REM
  61. REM          Check for LOCAL session, and warn user accordingly.
  62. REM
  63. IF EXIST $FAILURE DEL $FAILURE
  64. IF %1==N GOTO LOCAL
  65. IF %2==LOCAL GOTO LOCAL
  66. REM
  67. REM          Branch processing based on the protocol keyword.
  68. REM
  69. IF %4==KERMIT GOTO KERMIT
  70. IF %4==XMODEM_CS GOTO XMODEMCRC
  71. IF %4==XMODEM1K GOTO XMODEM1K
  72. IF %4==XMODEMCRC GOTO XMODEMCRC
  73. IF %4==YMODEM GOTO YMODEM
  74. IF %4==ZMODEM GOTO ZMODEM
  75. GOTO ERROR04
  76. REM -------------------------------------------------------------------------
  77. :KERMIT
  78. REM          $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  79. REM          $$$$$$$$$$$$$$$$$$$$  KERMIT PROCESSING  $$$$$$$$$$$$$$$$$$$$$$$
  80. REM          $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  81. REM
  82. REM          Parameter %3 determines if this is a SEND or RECEIVE.
  83. REM
  84. IF %3==RECEIVE GOTO KERMRECV
  85. IF %3==SEND GOTO KERMSEND
  86. REM
  87. REM
  88. REM          If match for %3 was not found, there is something wrong.
  89. GOTO ERROR03
  90. :KERMRECV
  91. %WR-BBS%\PCKERMIT -b %2 -l COM%1 -r -a %5 -c
  92. GOTO FINISHED
  93. :KERMSEND
  94. %WR-BBS%\PCKERMIT -l COM%1 -b %2 -s %5 -c
  95. GOTO FINISHED
  96. REM -------------------------------------------------------------------------
  97. :XMODEM1K
  98. REM          $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  99. REM          $$$$$$$$$$$$$$$$$$  XMODEM-1K PROCESSING $$$$$$$$$$$$$$$$$$$$$$$
  100. REM          $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  101. REM
  102. REM          Parameter %3 determines if this is a SEND or RECEIVE.
  103. REM
  104. IF %3==RECEIVE GOTO XM1_RECV
  105. IF %3==SEND GOTO XM1_SEND
  106. REM
  107. REM          If match for %3 was not found, there is something wrong.
  108. GOTO ERROR03
  109. :XM1_RECV
  110. REM
  111. REM          Invoke DSZ for the file transfer.    See DSZ documentation for
  112. REM          details on command line arguments.  Notice lower case letters,
  113. REM          which are required for correct  DSZ operation except where the
  114. REM          DSZ documentation explicitly indicates otherwise.  Remember to
  115. REM          register your copy of DSZ with DSZ's author!
  116. REM
  117. dsz port %1 rx %5
  118. REM
  119. REM          DSZ, like most file transfer protocols, will set the DOS
  120. REM          ERRORLEVEL to something other than zero  if any problems
  121. REM          were encountered. If a non-zero errorlevel was detected,
  122. REM          the following line simply puts  a  breif message  on the 
  123. REM          screen for the SysOp.
  124. REM
  125. IF ERRORLEVEL 1 GOTO ERROR05
  126. GOTO FINISHED
  127. :XM1_SEND
  128. REM
  129. REM          Invoke DSZ for the file transfer.    See DSZ documentation for
  130. REM          details on command line arguments.  Notice lower case letters,
  131. REM          which are required for correct  DSZ operation except where the
  132. REM          DSZ documentation explicitly indicates otherwise.  Remember to
  133. REM          register your copy of DSZ with DSZ's author!
  134. REM
  135. dsz port %1 sx -k %5
  136. REM
  137. REM          DSZ, like most file transfer protocols, will set the DOS
  138. REM          ERRORLEVEL to something other than zero  if any problems
  139. REM          were encountered. If a non-zero errorlevel was detected,
  140. REM          the following line simply puts  a  breif message  on the 
  141. REM          screen for the SysOp.
  142. REM
  143. IF ERRORLEVEL 1 GOTO ERROR05 
  144. GOTO FINISHED
  145. REM ------------------------------------------------------------------------
  146. :XMODEMCRC
  147. REM          $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  148. REM          $$$$$$$$$$$$$$$$$  XMODEM-CRC PROCESSING $$$$$$$$$$$$$$$$$$$$$$$
  149. REM          $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  150. REM
  151. REM          Parameter %3 determines if this is a SEND or RECEIVE.
  152. REM
  153. IF %3==RECEIVE GOTO XMC_RECV
  154. IF %3==SEND GOTO XMC_SEND
  155. REM
  156. REM          If match for %3 was not found, there is something wrong.
  157. GOTO ERROR03
  158. :XMC_RECV
  159. REM
  160. REM          Invoke DSZ for the file transfer.    See DSZ documentation for
  161. REM          details on command line arguments.  Notice lower case letters,
  162. REM          which are required for correct  DSZ operation except where the
  163. REM          DSZ documentation explicitly indicates otherwise.  Remember to
  164. REM          register your copy of DSZ with DSZ's author!
  165. REM
  166. dsz port %1 rc %5
  167. REM
  168. REM          DSZ, like most file transfer protocols, will set the DOS
  169. REM          ERRORLEVEL to something other than zero  if any problems
  170. REM          were encountered. If a non-zero errorlevel was detected,
  171. REM          the following line simply puts  a  breif message  on the 
  172. REM          screen for the SysOp.
  173. REM
  174. IF ERRORLEVEL 1 GOTO ERROR05
  175. GOTO FINISHED
  176. :XMC_SEND
  177. REM
  178. REM          Invoke DSZ for the file transfer.    See DSZ documentation for
  179. REM          details on command line arguments.  Notice lower case letters,
  180. REM          which are required for correct  DSZ operation except where the
  181. REM          DSZ documentation explicitly indicates otherwise.  Remember to
  182. REM          register your copy of DSZ with DSZ's author!
  183. REM
  184. dsz port %1 sx %5
  185. REM
  186. REM          DSZ, like most file transfer protocols, will set the DOS
  187. REM          ERRORLEVEL to something other than zero  if any problems
  188. REM          were encountered. If a non-zero errorlevel was detected,
  189. REM          the following line simply puts  a  breif message  on the 
  190. REM          screen for the SysOp.
  191. REM
  192. IF ERRORLEVEL 1 GOTO ERROR05
  193. GOTO FINISHED
  194. REM ------------------------------------------------------------------------
  195. :YMODEM
  196. REM          $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  197. REM          $$$$$$$$$$$$$$$$$$$$$ YMODEM PROCESSING $$$$$$$$$$$$$$$$$$$$$$$$
  198. REM          $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  199. REM
  200. REM          Parameter %3 determines if this is a SEND or RECEIVE.
  201. REM
  202. IF %3==RECEIVE GOTO YM_RECV
  203. IF %3==SEND GOTO YM_SEND
  204. REM
  205. REM          If match for %3 was not found, there is something wrong.
  206. GOTO ERROR03
  207. :YM_RECV
  208. REM
  209. REM          Invoke DSZ for the file transfer.    See DSZ documentation for
  210. REM          details on command line arguments.  Notice lower case letters,
  211. REM          which are required for correct  DSZ operation except where the
  212. REM          DSZ documentation explicitly indicates otherwise.  Remember to
  213. REM          register your copy of DSZ with DSZ's author!
  214. REM
  215. dsz port %1 restrict rb %5
  216. REM
  217. REM          DSZ, like most file transfer protocols, will set the DOS
  218. REM          ERRORLEVEL to something other than zero  if any problems
  219. REM          were encountered. If a non-zero errorlevel was detected,
  220. REM          the following line simply puts  a  breif message  on the 
  221. REM          screen for the SysOp.
  222. REM
  223. IF ERRORLEVEL 1 GOTO ERROR05
  224. GOTO FINISHED
  225. :YM_SEND
  226. REM
  227. REM          Invoke DSZ for the file transfer.    See DSZ documentation for
  228. REM          details on command line arguments.  Notice lower case letters,
  229. REM          which are required for correct  DSZ operation except where the
  230. REM          DSZ documentation explicitly indicates otherwise.  Remember to
  231. REM          register your copy of DSZ with DSZ's author!
  232. REM
  233. dsz port %1 sb %5
  234. REM
  235. REM          DSZ, like most file transfer protocols, will set the DOS
  236. REM          ERRORLEVEL to something other than zero  if any problems
  237. REM          were encountered. If a non-zero errorlevel was detected,
  238. REM          the following line simply puts  a  breif message  on the 
  239. REM          screen for the SysOp.
  240. REM
  241. IF ERRORLEVEL 1 GOTO ERROR05
  242. GOTO FINISHED
  243. REM ------------------------------------------------------------------------
  244. :ZMODEM
  245. REM          $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  246. REM          $$$$$$$$$$$$$$$$$$$$$ ZMODEM PROCESSING $$$$$$$$$$$$$$$$$$$$$$$$
  247. REM          $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  248. REM
  249. REM          Parameter %3 determines if this is a SEND or RECEIVE.
  250. REM
  251. IF %3==RECEIVE GOTO ZM_RECV
  252. IF %3==SEND GOTO ZM_SEND
  253. REM
  254. REM          If match for %3 was not found, there is something wrong.
  255. GOTO ERROR03
  256. :ZM_RECV
  257. REM
  258. REM          Invoke DSZ for the file transfer.    See DSZ documentation for
  259. REM          details on command line arguments.  Notice lower case letters,
  260. REM          which are required for correct  DSZ operation except where the
  261. REM          DSZ documentation explicitly indicates otherwise.  Remember to
  262. REM          register your copy of DSZ with DSZ's author!
  263. REM
  264. dsz port %1 restrict rz %5
  265. REM
  266. REM          DSZ, like most file transfer protocols, will set the DOS
  267. REM          ERRORLEVEL to something other than zero  if any problems
  268. REM          were encountered. If a non-zero errorlevel was detected,
  269. REM          the following line simply puts  a  breif message  on the 
  270. REM          screen for the SysOp.
  271. REM
  272. IF ERRORLEVEL 1 GOTO ERROR05
  273. GOTO FINISHED
  274. :ZM_SEND
  275. REM
  276. REM          Invoke DSZ for the file transfer.    See DSZ documentation for
  277. REM          details on command line arguments.  Notice lower case letters,
  278. REM          which are required for correct  DSZ operation except where the
  279. REM          DSZ documentation explicitly indicates otherwise.  Remember to
  280. REM          register your copy of DSZ with DSZ's author!
  281. REM
  282. dsz port %1 sz %5
  283. REM
  284. REM          DSZ, like most file transfer protocols, will set the DOS
  285. REM          ERRORLEVEL to something other than zero  if any problems
  286. REM          were encountered. If a non-zero errorlevel was detected,
  287. REM          the following line simply puts  a  breif message  on the 
  288. REM          screen for the SysOp.
  289. REM
  290. IF ERRORLEVEL 1 GOTO ERROR05
  291. GOTO FINISHED
  292. REM ------------------------------------------------------------------------
  293. :LOCAL
  294. REM          (Local session in progress - can't use protocols)
  295. ECHO File transfer protocols cannot be used during local logon!
  296. GOTO FINISHED
  297. :ERROR01
  298. REM          (No parameters at all)
  299. ECHO ERROR:  No parameters!
  300. GOTO FINISHED
  301. :ERROR02
  302. REM          (An incorrect number of parameters was passed to this batch)
  303. ECHO ERROR:  Invalid number of parameters!
  304. ECHO.
  305. IF NOT W%1W==WW ECHO PARAMETER 1 = %1
  306. IF NOT W%2W==WW ECHO PARAMETER 2 = %1
  307. IF NOT W%3W==WW ECHO PARAMETER 3 = %1
  308. IF NOT W%4W==WW ECHO PARAMETER 4 = %1
  309. IF NOT W%5W==WW ECHO PARAMETER 5 = %1
  310. IF NOT W%6W==WW ECHO PARAMETER 6 = %1
  311. IF NOT W%7W==WW ECHO PARAMETER 7 = %1
  312. GOTO FINISHED
  313. :ERROR03
  314. REM         (Parameter # 3 is invalid)
  315. ECHO ERROR: Invalid keyword (%3)
  316. GOTO FINISHED
  317. :ERROR04
  318. REM         (Protocol keyword not found)
  319. ECHO  ERROR: Undefined protocol (%4)
  320. GOTO FINISHED
  321. :ERROR05
  322. REM         (Transfer failure detected: non-zero errorlevel )
  323. REM
  324. REM         To signal to WR-BBS that an error has occurred,  a "flag" file
  325. REM         is created by redirecting a string into a file named $FAILURE,
  326. REM         which will be created in the current directory. 
  327. REM
  328. ECHO Error detected during %3 of %5. > $FAILURE
  329. ECHO.
  330. ECHO ERROR OCCUURED DURING %4 %3 OF %5!
  331. ECHO.
  332. :FINISHED
  333.